#pragma once

//#include <dxerr9.h>
#include <dsound.h>

#include "dsutil.h"
#include "dxutil.h"

#include <string>
using namespace std;

// Forward Declares
class CSound;
class CWaveFile;

class dxSound
{
public:

	/* Singelton Direct Sound is called in GlobalDefines.h */
	static dxSound &getInstance(){static dxSound pInstance;return pInstance;}

	dxSound();
	~dxSound();

	bool initDirectSound(HWND hwnd);
	void shutdownDirectSound(void);
	LPDIRECTSOUNDBUFFER LoadWaveToSoundBuffer(std::string wavFilename);

	void playSound(LPDIRECTSOUNDBUFFER whichBuffer);
	void playSoundLoop(LPDIRECTSOUNDBUFFER whichBuffer);
	void stopSound(LPDIRECTSOUNDBUFFER whichBuffer);

private:

	LPDIRECTSOUND8        m_pDS;
	HWND			  wndHandle;
};